package com.zbb.user.api;

import com.zbb.base.model.Result;
import com.zbb.user.mapper.UserMapper;
import com.zbb.user.model.dto.UserRegisterFrom;
import com.zbb.user.model.po.User;
import com.zbb.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author itcast
 */
@Api(value = "用户信息查询/编辑接口",tags = "用户信息查询/编辑接口")
@RestController
public class UserController {

    @Autowired
    private UserService  userService;



    @ApiOperation("用户信息查询/服务调用")
    @GetMapping("userInfo/{userId}")
    public User querytUser(@PathVariable("userId") String userId){
        User user = userService.queryUserInfo(userId);
        return user;
    }

    @ApiOperation("用户信息更改")
    @PostMapping("/updateUser")
    public User updateUser(@RequestBody User user){
        User resultUser = userService.updateUser(user);
            return resultUser;
    }




    @ApiOperation("用户信息查询前端调用")
    @GetMapping("userInfo1/{userId}")
    public Result querytUser1(@PathVariable("userId") String userId){
        User user = userService.queryUserInfo(userId);
        return Result.ok(user);
    }

}
